#include "qmyswitchbutton.h"
#include "ui_qmyswitchbutton.h"

QMySwitchButton::QMySwitchButton(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::QMySwitchButton)
{
    ui->setupUi(this);
    this->initForm();
}

QMySwitchButton::~QMySwitchButton()
{
    delete ui;
}

void QMySwitchButton::initForm()
{
    ui->imageSwitch1->setChecked(true);
    ui->imageSwitch2->setChecked(true);
    ui->imageSwitch3->setChecked(true);

    ui->imageSwitch1->setFixedSize(87,30);
    ui->imageSwitch2->setFixedSize(87,30);
    ui->imageSwitch3->setFixedSize(87,30);

    ui->imageSwitch1->setButtonStyle(QMyImageButton::ButtonStyle_1);
    ui->imageSwitch2->setButtonStyle(QMyImageButton::ButtonStyle_2);
    ui->imageSwitch3->setButtonStyle(QMyImageButton::ButtonStyle_3);

    connect(ui->imageSwitch1,SIGNAL(checkedChangeed(bool)),this,SLOT(checkedChanged(bool)));
    connect(ui->imageSwitch2,SIGNAL(checkedChangeed(bool)),this,SLOT(checkedChanged(bool)));
    connect(ui->imageSwitch3,SIGNAL(checkedChangeed(bool)),this,SLOT(checkedChanged(bool)));
}

void QMySwitchButton::checkedChanged(bool checked)
{
    qDebug() << sender() << checked;
}


